//
//  PageTableView.m
//  MBForeigner
//
//  Created by 鲁万玺 on 2017/9/22.
//  Copyright © 2017年 Foreigner. All rights reserved.
//

#import "PageTableView.h"

@implementation PageTableView

- (instancetype)init
{
    if (self = [super init])
    {
        self.tableDataArr = [NSMutableArray array];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
{
    if (self = [super initWithFrame:frame style:style])
    {
        self.tableDataArr = [NSMutableArray array];
    }
    return self;
}

- (void)setMJHeadRefresh:(PageTableViewRefreshingBlock)refreshingBlock
{
    WS(ws)
    self.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        ws.page = 1;
        [ws.tableDataArr removeAllObjects];
        refreshingBlock();
    }];
    [self.mj_header beginRefreshing];
}

- (void)setMJFootRefresh:(PageTableViewRefreshingBlock)refreshingBlock
{
    WS(ws)
    self.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
        ws.page++;
        refreshingBlock();
    }];
}

- (void)stopRefresh
{
    [self.mj_header endRefreshing];
    [self.mj_footer endRefreshing];
}

@end
